﻿using OMG.Fill.Mulberry.Model;
using OMG.Fill.Mulberry.Service;
using ProjectShare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace OMG.Fill.Mulberry.UI.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            return View();
        }

        public ResResult<UserModel> Post(LoginModel model)
        {
            ResResult<UserModel> userinfo = new ResResult<UserModel>();
            UserServices user = new UserServices();
            userinfo = user.LoginUser(model.Account, model.Passwords);
            if (userinfo.model != null)
            {
                FormsAuthentication.SetAuthCookie(userinfo.model.Id.ToString(), model.IsRember);
            }
            return userinfo;
        }
    }
}
